//
//  StatusCellBottomView.m
//  OC-微博
//
//  Created by Apple on 15/11/13.
//  Copyright © 2015年 Apple. All rights reserved.
//

#import "StatusCellBottomView.h"
@interface StatusCellBottomView()
//转发
@property (nonatomic, strong) UIButton *retweetedButton;
//评论
@property (nonatomic, strong) UIButton *commentButton;
//赞
@property (nonatomic, strong) UIButton *likeButton;
@end
@implementation StatusCellBottomView
#pragma mark /*******************  构造函数  *******************/
- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self setupUI];
    }
    return self;
}
#pragma mark /*******************  设置界面  *******************/
- (void)setupUI {
    self.backgroundColor = [[UIColor alloc]initWithWhite:0.9 alpha:1.0];
    //设置控件
    [self addSubview:self.retweetedButton];
    [self addSubview:self.commentButton];
    [self addSubview:self.likeButton];
    //自动布局
    [self.retweetedButton makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.bottom.equalTo(self);
    }];
    [self.commentButton makeConstraints:^(MASConstraintMaker *make) {
        make.top.bottom.width.equalTo(self.retweetedButton);
        make.left.equalTo(self.retweetedButton.right);
    }];
    [self.likeButton makeConstraints:^(MASConstraintMaker *make) {
        make.top.bottom.width.equalTo(self.retweetedButton);
        make.left.equalTo(self.commentButton.right);
        
        make.right.equalTo(self.right);
            }];
    CGFloat w = 0.8;
    CGFloat scale = 0.4;
    UIView *setV1 = [self setLine];
    UIView *setV2 = [self setLine];
    [self addSubview:setV1];
    [self addSubview:setV2];
    [setV1 makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.retweetedButton.right);
        make.centerY.equalTo(self.retweetedButton.centerY);
        make.width.equalTo(w);
        make.height.equalTo(self.retweetedButton.height).multipliedBy(scale);
    }];
    [setV2 makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.commentButton.right);
        make.centerY.equalTo(self.commentButton.centerY);
       make.width.equalTo(w);
        make.height.equalTo(self.commentButton.height).multipliedBy(scale);
    }];

    
}
#pragma mark /*******************  底部视图方法  *******************/
- (UIView *)setLine {
    UIView *v = [UIView new];
    v.backgroundColor = [UIColor darkGrayColor];
    return v;
}
#pragma mark /*******************  懒加载控件  *******************/
//懒加载
-(UIButton *)retweetedButton {
    
    if (_retweetedButton == nil) {
        _retweetedButton = [UIButton setimgName:@"timeline_icon_retweet" title:@" 转发" color:[UIColor darkGrayColor]];
    }
    return _retweetedButton;
}
//懒加载
-(UIButton *)commentButton {
    
    if (_commentButton == nil) {
        _commentButton = [UIButton setimgName:@"timeline_icon_comment" title:@" 评论" color:[UIColor darkGrayColor]];
    }
    return _commentButton;
}
//懒加载
-(UIButton *)likeButton {
    
    if (_likeButton == nil) {
        _likeButton = [UIButton setimgName:@"timeline_icon_unlike" title:@" 点赞" color:[UIColor darkGrayColor]];
        
    }
    return _likeButton;
}

@end
